package apps.generate.domain;

import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang.StringUtils;

public class DBFieldBean {
	
	/**
	 * 字段名称
	 */
	private String fieldName;
	
	/**
	 * 首字母大写
	 */
	private String uFieldName;
	
	/**
	 * java类中的字段名称
	 */
	private String javaFieldName;
	
	/**
	 * 备注
	 */
	private String remark;
	
	/**
	 * 字段类型
	 */
	private String fieldType;

	/**
	 * 对应java类型
	 */
	private String javaType;
	
	public String toString() {
		return "DBFieldBean [fieldName=" + fieldName + ", remark=" + remark
		+ ", fieldType=" + fieldType + "]";		
	}
	
	public DBFieldBean() {
		super();
	}

	public String getFieldName() {
		return fieldName;
	}

	public void setFieldName(String fieldName) {
		this.fieldName = fieldName;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getFieldType() {
		return fieldType;
	}

	public void setFieldType(String fieldType) {
		this.fieldType = fieldType;
	}

	public String getJavaType() {
		javaType=fieldType;
		Map<String, String> map=new HashMap<String, String>();
		map.put("VARCHAR2", "String");
		map.put("TIMESTAMP(6)", "Date");
		map.put("NUMBER", "int");
		map.put("CLOB", "String");
		if(map.containsKey(fieldType)) javaType=map.get(fieldType);
		return javaType ;
	}

	public void setJavaType(String javaType) {
		this.javaType = javaType;
	}

	public String getUFieldName() {
		uFieldName=fieldName.substring(0, 1).toUpperCase()+fieldName.substring(1);
		return fieldName;
	}

	public void setUFieldName(String fieldName) {
		uFieldName = fieldName;
	}

	public String getJavaFieldName() {
		return javaFieldName;
	}

	public void setJavaFieldName(String javaFieldName) {
		this.javaFieldName = javaFieldName;
	}


}
